<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>行政级区域站点</title>
    <link rel="stylesheet" href="../../libs/node_modules/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../../style/common.css">
    <link rel="stylesheet" href="../../style/home/article.css">
    <link rel="stylesheet" href="../../style/home/stationB.css">

    <script src="../../libs/vue.js"></script>
    <script src="../../libs/jquery-3.2.1.min.js"></script>
    <script src="../../jsc/axios.min.js"></script>
    <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> -->
    <script src="../../libs/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="../../libs/layer-v3.1.1/layer/layer.js"></script>
    <!--<script src="js/system.js"></script>-->
</head>
<body>

<main id="area" v-cloak>
<!--    <headertop-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></headertop-component>-->
    <header-component></header-component>
    <navsearch-component></navsearch-component>
    <navlink-component v-if="site_data && site_data.site_id" :siteid="site_data"></navlink-component>

    <!-- 主站导航 -->
    <navrow-component v-if="sitelevel == ''" :siteid="site_data"></navrow-component>
    <!-- 行政站导航 -->
    <navtab2-component v-if="sitelevel != 5 && sitelevel != '' " :siteid="site_data"></navtab2-component>
    <!-- 基层站导航 -->
    <navtab3-component v-if="sitelevel==5" :siteid="site_data"></navtab3-component>


    <div class="content stationB">
        <site-component :id="id"></site-component>
        <navlink2-component v-if="site_data && site_data.site_id" :siteid="site_data"></navlink2-component>

        <div class="notice-box">
            <div class="notice-item">
                <div class="notice-item-title">
                    <div class="notice-item-title-l">政府公告</div>
                    <a class="notice-item-title-r" href="../../views/about/public.html?id=49&station_type=2&banner_type=237#/3?id=50">更多&gt;</a>
                </div>
                <div class="notice-item-box">
                    <ul v-if="adminList1.length">
                        <li v-for="(item,index) in adminList1"><span></span><a href="javascript:void(0)" @click="goToMore(1,item.id)" :data-id="item.id" :title="item.title">{{item.title}}</a></li>
                    </ul>
                </div>
            </div>
            <div class="notice-item">
                <div class="notice-item-title">
                    <div class="notice-item-title-l">政府工作</div>
                    <a class="notice-item-title-r" href="../../views/about/public.html?id=49&station_type=2&banner_type=237#/3?id=51">更多&gt;</a>
                </div>
                <div class="notice-item-box">
                    <ul v-if="adminList2.length">
                        <li v-for="(item,index) in adminList2"><span></span><a href="javascript:void(0)" @click="goToMore(2,item.id)" :data-id="item.id" :title="item.title"  :data-id="item.id" >{{item.title}}</a></li>
                    </ul>
                </div>
            </div>
            <div class="notice-item">
                <div class="notice-item-title">
                    <div class="notice-item-title-l">党建工作</div>
                    <a class="notice-item-title-r" href="../../views/about/public.html?id=49&station_type=2&banner_type=237#/3?id=52">更多&gt;</a>
                </div>
                <div class="notice-item-box">
                    <ul v-if="adminList3.length">
                        <li v-for="(item,index) in adminList3"><span></span><a href="javascript:void(0)" @click="goToMore(3,item.id)" :data-id="item.id" :title="item.title" :data-id="item.id" >{{item.title}}</a></li>
                    </ul>
                </div>
            </div>
        </div>

        <tasklist-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></tasklist-component>
        <liveserve-component v-if="site_data && site_data.site_id" :siteid="site_data"></liveserve-component>

        <div class="Exhibition-container">
            <div class="Exhibition-l">
                <classifysite-component v-if="site_data && site_data.site_id" :siteid="site_data"></classifysite-component>
                <knowledge-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></knowledge-component>
                <legalsystem-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></legalsystem-component>
                <report-component v-if="site_data && site_data.site_id" :siteid="site_data"></report-component>
            </div>
            <div class="Exhibition-r">
                <notice-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></notice-component>
                <survey-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></survey-component>
                <news-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></news-component>
                <publicinterest-component v-if="site_data && site_data.site_id" :siteid="site_data" url="../../"></publicinterest-component>
            </div>
        </div>
        <div class="adv-row" v-if="banner2.length">
            <a :href="item.url" v-for="(item,index) in banner2" :title="item.name" v-if="index > 4">
                <img :src="item.image_text" :alt="item.name" style="height: 5.75rem">
            </a>
        </div>
        <div class="adv-row" v-if="banner3.length">
            <a :href="item.url" v-for="(item,index) in banner3" :title="item.name" v-if="index > 4">
                <img :src="item.image_text" :alt="item.name" style="height: 5.75rem">
            </a>
        </div>
        <friend-component></friend-component>
    </div>

    <footer-component url="../../"></footer-component>
</main>
<script src="../../jsc/common.js"></script>
<script src="../../jsc/component.js"></script>

<script>
    var site = JSON.parse(window.localStorage.getItem("station")) || {}

    var search = new Vue({
        el:"#area",
        data    : {
            parameter:parameter,
            bannerList:[44,45,42],              // 行政区域bannber category_id(分类id);
            adminArray:[73,74,75],
            id:{province_id:1},
            baseURL:"../../views",
            site_data:"",

            banber1:"",                  // banner 分站顶部广告
            banner2:"",                  // banner 分站导航栏下1x4广告
            banner3:"",                  // banner 首页底部1x1广告

            adminList1:[],               // 行政站数据列表
            adminList2:[],               // 行政站数据列表
            adminList3:[],               // 行政站数据列表

            taskType:1,                 // 当前选择的操作位置  1: 跑腿服务  2：任务发布  3：任务大厅
            taskList:"",                // 任务数据列表

            serveList:"",               // 生活服务数据列表
            serveCenterList:"",         // 生活服务数据列表

            sitelevel:"",
        },
        mounted(){
            this.type = parameter.type;
            this.keyWord = decodeURIComponent(parameter.keyword);

            if(this.parameter.siteid && ( this.parameter.siteid != site.site_id) ){
                axios.post(sysurl + 'user/siteInfo' , {site_id : this.parameter.siteid} ).then(res => {
                    var datas = res.data;
                    if( datas.code === 1 ){
                        window.localStorage.setItem("station",JSON.stringify(datas.data));
                        this.site_data = datas.data;
                        this.sitelevel = datas.data.site_level;

                        this.getBannerList();
                        this.getSiteNavigation();
                    }else{
                        layer.msg(res.data.msg);
                    }
                } , err => {}).catch(( error ) => {});
            }else{
                this.site_data = site;
                this.sitelevel = site.site_level;

                this.getBannerList();
                this.getSiteNavigation();
            }
        } ,
        methods : {
            // 获取 行政区域 bannber
            getBannerList(){
                this.bannerList.map((item,index) => {
                    axios.post(sysurl + 'index/bannerAds' , { site_id : site.site_id, category_id : item }).then(res => {
                        var data = res.data;
                        if( data.code == 1 ){
                            switch( item ){
                                case 44:
                                    this.banner1 = data.data;
                                    break;
                                case 45:
                                    this.banner2 = data.data;
                                    break;
                                case 42:
                                    this.banner3 = data.data;
                            }
                        }else{
                            layer.msg(res.data.msg);
                        }
                    } , err => {}).catch(( error ) => {});
                })
            },
            // 行政站 ： category_id :  73=政府公告,74=政府动态,75=党建工作
            getSiteNavigation(){
                this.adminArray.map((item,index) => {
                    var forms = new FormData()
                    forms.append("site_id",this.site_data.site_id)
                    forms.append("category_id",item)
                    forms.append("limit",8)
                    forms.append("page",1)
                    axios.post(sysurl + 'article/areaArticleList' , forms).then(res => {
                        var data = res.data;
                        if( data.code == 1 ){
                            switch( item ){
                                case 73:        // 50 = 政府公告
                                    this.adminList1 = data.data.data;
                                    break;
                                case 74:        // 51 = 政府工作
                                    this.adminList2 = data.data.data;
                                    break;
                                case 75:        // 52 = 党建工作
                                    this.adminList3 = data.data.data;
                                    break;
                            }
                        }else{
                            layer.msg(res.data.msg);
                        }
                    } , err => {}).catch(( error ) => {});
                })

            },
            goToMore(type,id){
                // if(type == 'detail'){
                //     window.location.href = `../../views/site/sitelist.html?id=${id}&category_id=${category_id}&category_name=${name}&type=detail`;
                // }else{
                //     window.location.href = `../../views/site/sitelist.html?id=${category_id}&category_name=${name}`;
                // }

                    var forms = new FormData()
                    forms.append("article_id",id)
                    forms.append("type",2)
                    axios.post(sysurl + 'index/articleCategoryGetNavId',forms).then(res => {
                        var data = res.data;
                        if( data.code === 1 ){
                            // if(type == 1){
                                window.location.href ="../../views/about/public.html?id=49&station_type=2&banner_type=237#/3?id="+data.data.id+"&url="+data.data.url+"&a_id="+id
                            // }
                            // else if(type == 2){
                            //     window.location.href ="../../views/about/public.html?id=102&station_type=3&banner_type=242#/3?id="+data.data.id+"&url="+data.data.url+"&a_id="+id
                            //
                            // }
                            // else if(type == 3){
                            //     window.location.href ="../../views/about/public.html?id=108&station_type=3&banner_type=241#/3?id="+data.data.id+"&url="+data.data.url+"&a_id="+id
                            //
                            // }
                        }else{
                            layer.msg(res.data.msg);
                        }
                    } , err => {}).catch(( error ) => {});



            }
        } ,
        filters : {} ,
    })
</script>
</body>
</html>
